diff options
| author | diogo464 <[email protected]> | 2025-08-11 16:04:32 +0100 |
|---|---|---|
| committer | diogo464 <[email protected]> | 2025-08-11 16:04:32 +0100 |
| commit | f4d8a26972728891de8bde4eeb94c80f027ce2d2 (patch) | |
| tree | 3c8b9c25c2a1e3fab7a86f51922c39eb2ed93697 /frontend/app/drive/[...path]/page.tsx | |
| parent | 32b008a9c0c8e0130ab10bc96ffea9232f9cf95a (diff) | |
basic v0 ui working
Diffstat (limited to 'frontend/app/drive/[...path]/page.tsx')
| -rw-r--r-- | frontend/app/drive/[...path]/page.tsx | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/frontend/app/drive/[...path]/page.tsx b/frontend/app/drive/[...path]/page.tsx deleted file mode 100644 index be11253..0000000 --- a/frontend/app/drive/[...path]/page.tsx +++ /dev/null | |||
| @@ -1,58 +0,0 @@ | |||
| 1 | import { Drive_ls } from "@/lib/drive_server" | ||
| 2 | import { Drive_parent } from "@/lib/drive_shared" | ||
| 3 | import Link from "next/link" | ||
| 4 | import { Auth_get_user, Auth_user_can_upload } from "@/lib/auth"; | ||
| 5 | import FileUpload from "@/components/FileUpload" | ||
| 6 | import FileTable from "@/components/FileTable" | ||
| 7 | |||
| 8 | interface DrivePageProps { | ||
| 9 | params: Promise<{ | ||
| 10 | path: string[] | ||
| 11 | }> | ||
| 12 | } | ||
| 13 | |||
| 14 | export default async function DrivePage({ params }: DrivePageProps) { | ||
| 15 | // Await params as required by Next.js 15 | ||
| 16 | const { path } = await params | ||
| 17 | |||
| 18 | const user = await Auth_get_user(); | ||
| 19 | |||
| 20 | // Construct the full path from params | ||
| 21 | const fullPath = path ? `/${path.join('/')}` : "" | ||
| 22 | |||
| 23 | const entries = await Drive_ls(fullPath, false) | ||
| 24 | |||
| 25 | // Check if we have a parent directory | ||
| 26 | const parentDir = Drive_parent(fullPath) | ||
| 27 | const parentPath = path && path.length > 1 | ||
| 28 | ? `/drive/${path.slice(0, -1).join('/')}` | ||
| 29 | : path && path.length === 1 | ||
| 30 | ? '/drive' | ||
| 31 | : null | ||
| 32 | |||
| 33 | const showParent = parentDir !== null && parentPath !== null | ||
| 34 | |||
| 35 | return ( | ||
| 36 | <div className="min-h-screen bg-background"> | ||
| 37 | <div className="container mx-auto p-4"> | ||
| 38 | <Link href="/drive" className="inline-block mb-6"> | ||
| 39 | <h1 className="text-2xl font-bold text-foreground hover:text-blue-600 dark:hover:text-blue-400 transition-colors cursor-pointer">FCTDrive</h1> | ||
| 40 | </Link> | ||
| 41 | |||
| 42 | <FileTable | ||
| 43 | entries={entries} | ||
| 44 | currentPath={fullPath} | ||
| 45 | showParent={showParent} | ||
| 46 | parentPath={parentPath || undefined} | ||
| 47 | /> | ||
| 48 | |||
| 49 | {/* File Upload Component */} | ||
| 50 | {Auth_user_can_upload(user) && ( | ||
| 51 | <FileUpload | ||
| 52 | targetPath={fullPath} | ||
| 53 | /> | ||
| 54 | )} | ||
| 55 | </div> | ||
| 56 | </div> | ||
| 57 | ) | ||
| 58 | } | ||
